@import 'mediawiki.skin.variables.less';
@import 'mediawiki.mixins.less';
@import 'mediawiki.ui/variables';

/* Uses standard message block colors, compare mediawiki.legacy/shared.css */
.mw-email-not-authenticated .oo-ui-labelWidget,
.mw-email-none .oo-ui-labelWidget {
	color: #000;
	border-width: 1px;
	border-style: solid;
	padding: 8px 12px;
}

.mw-email-not-authenticated .oo-ui-labelWidget {
	background-color: #fef6e7;
	border-color: #fc3;
}

.mw-email-none .oo-ui-labelWidget {
	background-color: #eaecf0;
	border-color: #a2a9b1;
}

/* Authenticated email field has its own class too. Unstyled by default */
/*
.mw-email-authenticated .oo-ui-labelWidget { }
*/

.mw-prefs-buttons {
	background-color: #fff;
	border-top: 1px solid #c8ccd1;
	padding: 1em 0;
	// Add top box shadow on top only to emphasize content is scrollable underneath `sticky`.
	box-shadow: 0 -4px 4px -4px rgba( 0, 0, 0, 0.25 );
}

/* This is needed because add extra buttons in a weird way */
.mw-prefs-buttons .mw-htmlform-submit-buttons {
	margin: 0;
}

/*
 * Hide, when not keyboard focussed.
 */
.client-js .mw-navigation-hint:not( :focus ) {
	height: 0;
	overflow: hidden;
}

.mw-prefs-tabs {
	.mw-prefs-fieldset-wrapper {
		padding-left: 0;
		padding-right: 0;

		&:first-child {
			padding-top: 0;
		}

		&:last-child {
			padding-bottom: 0;
		}
	}
}

.mw-prefs-tabs-wrapper.oo-ui-panelLayout-framed,
.mw-prefs-tabs > .oo-ui-menuLayout-content > .oo-ui-indexLayout-stackLayout > .oo-ui-tabPanelLayout {
	/* Decrease contrast of `border` slightly as padding/border combination is sufficient
	 * accessibility wise and focus of content is more important here. */
	border-color: #c8ccd1;
}

/* JavaScript disabled */
.client-nojs {
	// Disable .oo-ui-panelLayout-framed on outer wrapper
	.mw-prefs-tabs-wrapper {
		border-width: 0;
		border-radius: 0;
	}

	.mw-prefs-tabs {
		// Hide the tab menu when JS is disabled as we can't use this feature
		> .oo-ui-menuLayout-menu {
			display: none;
		}

		.mw-prefs-section-fieldset {
			// <legend> is hard to style, so apply border to top of group
			> .oo-ui-fieldsetLayout-group {
				padding-top: 1.5em;
				border-top: 1px solid #c8ccd1;
			}

			// Remove spacing between legend and underline
			&.oo-ui-labelElement > .oo-ui-fieldsetLayout-header > .oo-ui-labelElement-label {
				margin-bottom: 0;
			}
		}

		// Spacing between sections
		> .oo-ui-menuLayout-content > .oo-ui-indexLayout-stackLayout > .oo-ui-tabPanelLayout:not( :last-child ) {
			margin-bottom: 1em;
		}
	}
}

/* JavaScript enabled */
.client-js .mw-prefs-tabs {
	.oo-ui-tabPanelLayout {
		// Panels don't need borders as the IndexLayout is inside a framed wrapper.
		border: 0;

		// Hide section legend, only used in nojs mode
		> fieldset > legend {
			display: none;
		}
	}

	// Hide all but the first panel before infusion
	&:not( .mw-prefs-tabs-infused ) {
		.oo-ui-tabPanelLayout:not( :first-child ) {
			display: none;
		}
	}
}

// Highlight section header when linking to a section, e.g. Special:Preferences#mw-prefsection-editing-preview.
.oo-ui-fieldsetLayout:target > .oo-ui-fieldsetLayout-header > .oo-ui-labelElement-label {
	width: 100%;
	background-color: #eaf3ff;
	outline: 4px solid #eaf3ff;
}

@media all and ( min-width: @width-breakpoint-tablet ) {
	/* Make the "Basic information" section more compact */
	/* OOUI's `align: 'left'` for FieldLayouts sucks, so we do our own */
	#mw-htmlform-info {
		> .oo-ui-fieldLayout-align-top > .oo-ui-fieldLayout-body > .oo-ui-fieldLayout-header {
			display: inline-block;
			width: 20%;
			padding: 0;
			vertical-align: middle;
		}

		> .oo-ui-fieldLayout-align-top .oo-ui-fieldLayout-help {
			margin-right: 0;
		}

		> .oo-ui-fieldLayout.oo-ui-fieldLayout-align-top > .oo-ui-fieldLayout-body > .oo-ui-fieldLayout-field {
			display: inline-block;
			width: 80%;
			vertical-align: middle;
		}
	}
}

/* Compact number inputs, used at "Display options" on "Recent changes" */
.mw-htmlform-field-HTMLFloatField,
.mw-htmlform-field-HTMLIntField {
	.oo-ui-inputWidget {
		max-width: 10em;
	}
}

/* Expand the dropdown and textfield of "Time zone" field to the */
/* usual maximum width and display them on separate lines. */
#wpTimeCorrection .oo-ui-dropdownInputWidget,
#wpTimeCorrection .oo-ui-textInputWidget {
	display: block;
	max-width: 50em;
}

#wpTimeCorrection .oo-ui-textInputWidget {
	margin-top: 0.5em;
}

/* T311717 - Styles for Special:Preferences on mobile
These are used when users navigate to Special:Preferences
with params ?useskin=vector&useformat=mobile
*/
.mw-mobile-prefsection {
	cursor: pointer;
	padding-top: 0.3125em;
	border-bottom: 0.0625em solid @colorGray12;
}

.mw-mobile-prefsection:hover {
	background-color: @colorGray15;
}

.mw-mobile-prefsection:last-child {
	border-bottom: none; // stylelint-disable-line declaration-property-value-disallowed-list
}

.oo-ui-iconWidget.mw-prefs-icon {
	color: @colorGray2;
	margin: 0.5em 0.5em 0 0.5em;
	width: 1.25em;
	height: 1.25em;
}

.mw-prefs-title {
	font-weight: normal;
	font-size: 1em;
	line-height: 1.25em;
	color: @colorGray2;
}

.mw-prefs-description {
	font-weight: normal;
	font-size: 0.875em;
	line-height: 1.25em;
	padding: 0 2.7em;
	color: @colorGray7;
	margin-top: 0 !important; /* stylelint-disable-line declaration-no-important */
}

.mw-prefs-header-container {
	display: flex;
}

/* Override default inline styles for 'larger' dialog */
.oo-ui-windowManager-modal > .oo-ui-dialog.oo-ui-window-active.mw-mobile-pref-window {
	padding-top: 0;
}

/* Overriding default inline styles for 'larger' dialog */
.mw-mobile-pref-window > .oo-ui-window-frame {
	width: auto !important; /* stylelint-disable-line declaration-no-important */
	height: 100% !important; /* stylelint-disable-line declaration-no-important */
	max-height: 100% !important; /* stylelint-disable-line declaration-no-important */
}

.oo-ui-window-head.mw-mobile-pref-dialog-head {
	width: 100%;
	height: 3em;
	display: flex;
	align-items: center;
	border-bottom: 1px solid @colorGray12;
	box-shadow: 0 0.25em 0.125em -0.1875em rgba( 0, 0, 0, 0.25 );
	position: fixed;
	background: #fff;
}

.oo-ui-window-head.mw-mobile-pref-dialog-head > div > h5.mw-prefs-header-title {
	font-size: 1em;
	font-weight: bold;
	line-height: 1.25em;
}

.oo-ui-window-body.mw-mobile-pref-dialog-body {
	margin-right: 5px;
	margin-top: 49px;
	padding-bottom: 66px;
}

.oo-ui-window-body.mw-mobile-pref-dialog-body > div.oo-ui-widget-enabled > div {
	padding: 16px;
}

.oo-ui-window-body.mw-mobile-pref-dialog-body > div.oo-ui-widget-enabled > div:last-child {
	margin-bottom: 16px;
}

/* T317110: sub-section title  */
.oo-ui-window-body.mw-mobile-pref-dialog-body > div.oo-ui-widget-enabled > div.mw-prefs-fieldset-wrapper > fieldset.oo-ui-fieldsetLayout.oo-ui-labelElement > legend.oo-ui-fieldsetLayout-header {
	border-bottom: 1px #000 solid;
	max-width: 100%;
}

/* T317110: sub-section and sub-sub-section titles  */
.oo-ui-window-body.mw-mobile-pref-dialog-body div.oo-ui-widget-enabled > div.mw-prefs-fieldset-wrapper > fieldset.oo-ui-fieldsetLayout.oo-ui-labelElement > legend.oo-ui-fieldsetLayout-header > span.oo-ui-labelElement-label {
	font-size: 1em;
	font-weight: bold;
	line-height: 1.25em;
	margin-bottom: 12px;
}

/* T317110: preference separation  */
.oo-ui-window-body.mw-mobile-pref-dialog-body div.oo-ui-widget-enabled > div.mw-prefs-fieldset-wrapper > fieldset.oo-ui-fieldsetLayout > div.oo-ui-fieldsetLayout-group > div.oo-ui-widget-enabled > div > div {
	padding: 12px 0;
	margin: 0;
	border-bottom: 1px #eaecf0 solid;
}

/* T317110: preference label  */
.oo-ui-window-body.mw-mobile-pref-dialog-body .oo-ui-labelElement-label {
	line-height: 1.25em;
}

/* T317110: help text  */
.oo-ui-window-body.mw-mobile-pref-dialog-body div.oo-ui-fieldLayout-body label.oo-ui-inline-help.oo-ui-labelElement-label.oo-ui-labelElement.oo-ui-labelWidget {
	font-size: 0.875em;
	line-height: 1.25em;
}

/* T317110: non-interactive text */
.oo-ui-window-body.mw-mobile-pref-dialog-body .oo-ui-labelElement-label.oo-ui-labelElement.oo-ui-labelWidget {
	color: #72777d;
}

.oo-ui-window-foot > .mw-prefs-buttons {
	padding-left: 16px;
}

.oo-ui-window-body .oo-ui-fieldLayout-messages {
	background-color: #fff;
}

.oo-ui-iconWidget.mw-prefs-header-icon {
	color: @colorGray2;
	cursor: pointer;
	width: 1.25em;
	height: 1.25em;
	margin: 0 16px 0 17px;
}

.mw-prefs-header-title {
	display: inline-flex;
}

// stylelint-disable-next-line selector-class-pattern
.content p {
	margin: 0 0 0.75em 0 !important; // stylelint-disable-line declaration-no-important
}

// stylelint-disable-next-line selector-class-pattern
.content h5 {
	padding-bottom: 0.25em !important; // stylelint-disable-line declaration-no-important
}
